syntactic parse tree.tex (2010B)
1 \begin{tikzpicture}[ 2 word after/.style={right=0.9mm of #1, inner sep=0}, 3 punctuation after/.style={right=0mm of #1, inner sep=0}, 4 POS/.style={inner sep=0.4mm}, 5 node to word/.style={dashed}, 6 arc label/.style={pos=0.5,sloped,above}, 7 ] 8 % (ROOT (S (NP (NNP Syrielle)) (VP (VBD ate) (NP (ADJP (RB too) (JJ many)) (NNS potatoes))) (. .))) 9 \node[inner sep=0] (john) {\strut John}; 10 \node[word after=john] (ate) {\strut ate}; 11 \node[word after=ate] (too) {\strut too}; 12 \node[word after=too] (many) {\strut many}; 13 \node[word after=many] (tomatoes) {\strut tomatoes}; 14 \node[punctuation after=tomatoes] (period) {\strut .}; 15 16 \coordinate (lvl0) at (0, 3.75); 17 \coordinate (lvl1) at (0, 3); 18 \coordinate (lvl2) at (0, 2.25); 19 \coordinate (lvl3) at (0, 1.5); 20 \coordinate (lvl4) at (0, 0.75); 21 22 \node[POS] (NNP) at (lvl2-|john) {\texttt{NNP}}; 23 \node[POS] (VBD) at (lvl2-|ate) {\texttt{VBD}}; 24 \node[POS] (RB) at (lvl4-|too) {\texttt{RB}}; 25 \node[POS] (JJ) at (lvl4-|many) {\texttt{JJ}}; 26 \node[POS] (NNS) at (lvl3-|tomatoes) {\texttt{NNS}}; 27 28 \foreach \word/\constituant in {john/NNP, ate/VBD, too/RB, many/JJ, tomatoes/NNS}{ 29 \draw[node to word] (\word) -- (\constituant); 30 } 31 32 \coordinate (ADJPx) at ($(RB)!0.5!(JJ)$); 33 \coordinate (NP2x) at ($(ADJPx)!0.5!(NNS)$); 34 \coordinate (VPx) at ($(NP2x)!0.5!(VBD)$); 35 \coordinate (Sx) at ($(VPx)!0.5!(NNP)$); 36 37 \node[POS] (ADJP) at (lvl3-|ADJPx) {\texttt{ADJP}}; 38 \node[POS] (NP2) at (lvl2-|NP2x) {\(\texttt{NP}_2\)}; 39 \node[POS] (VP) at (lvl1-|VPx) {\texttt{VP}}; 40 \node[POS] (NP1) at (lvl1-|NNP) {\(\texttt{NP}_1\)}; 41 \node[POS] (S) at (lvl0-|Sx) {\texttt{S}}; 42 43 \draw[arrow] (S) -- (NP1); 44 \draw[arrow] (NP1) -- (NNP); 45 \draw[arrow] (S) -- (VP); 46 \draw[arrow] (VP) -- (VBD); 47 \draw[arrow] (VP) -- (NP2); 48 \draw[arrow] (NP2) -- (ADJP); 49 \draw[arrow] (ADJP) -- (RB); 50 \draw[arrow] (ADJP) -- (JJ); 51 \draw[arrow] (NP2) -- (NNS); 52 \end{tikzpicture}